// 这个getters模块.最终被挂载到的全局的getters节点 是为了方便获取这些getter
const getters = {
  sidebar: state => state.app.sidebar,
  device: state => state.app.device,
  token: state => state.user.token,
  name: state => state.user.userInfo.username,
  avatar: state => state.user.userInfo.staffPhoto,
  points: state => {
    // 因为退出后会重新计算, userInfo已经被设置为{} 所有加一个分支判断
    if (state.user.userInfo.roles) {
      return state.user.userInfo.roles.points
    }
  },
  companyName: state => state.user.userInfo.companyName,
  departmentName: state => state.user.userInfo.departmentName
}
export default getters
